<template>
  <view class="tab-component">
    <view class="right-tab-box">
      <view class="left-all" v-if="leftShow">
        <image
          src="/static/common/weipinhui/tabBar/collect-active.png"
          mode="widthFix"
        />
        <text class="selected">精选好货</text>
      </view>
      <view
        class="right-tab-item"
        v-for="(item, index) in menuList"
        :key="index"
      >
        <view class="top-content" v-if="item.tag">
          <text class="tag-text">{{ item.tag }}</text>
          <text class="iconfont icon-weibiaoti--10"></text>
        </view>
        <view class="image-box">
          <image :src="item.imageUrl" mode="widthFix" />
          <text class="title" v-if="item.title">{{ item.title }}</text>
        </view>
        <view class="price" v-if="item.price">
          {{ item.price }}
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { defineComponent, reactive, toRefs } from "vue";
export default defineComponent({
  name: "",
  props: {
    leftShow: {
      type: Boolean,
      default: true,
    },
    menuList: {
      type: Array,
      default: () => {
        return [
          {
            id: 21,
            title: "轻薄外套",
            imageUrl: "/static/components/tab/women/轻薄外套.jpg",
            price: "¥149",
          },
          {
            id: 22,
            title: "连体裙22222",
            imageUrl: "/static/components/tab/women/连体裙.jpg",
            price: "¥299",
          },
          {
            id: 23,
            title: "帽衫",
            imageUrl: "/static/components/tab/women/帽衫.jpg",
            price: "¥99",
          },
          {
            id: 24,
            title: "牛仔裤",
            imageUrl: "/static/components/tab/women/牛仔裤.jpg",
            price: "¥199",
          },
          {
            id: 31,
            title: "牛仔衣",
            imageUrl: "/static/components/tab/women/牛仔衣.png",
            price: "¥99",
          },
        ];
      },
    },
  },
  components: {},
  setup() {
    const data = reactive({});
    return {
      ...toRefs(data),
    };
  },
});
</script>

<style scoped lang="less">
.tab-component {
  display: flex;
  justify-content: space-between;
  padding: 10rpx 20rpx;
  padding-bottom: 10rpx;
  // 渐变
  background: linear-gradient(to right, #fceefa, #fef9fc, #fbe9f3);
  border-radius: 20rpx;
  overflow: hidden;
  .right-tab-box {
    flex: 1;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    .right-tab-item {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      position: relative;
      .top-content {
        display: flex;
        align-items: center;
        margin-bottom: 10rpx;
        .tag-text {
          font-size: 26rpx;
          font-weight: 700;
        }
        .icon-weibiaoti--10 {
          background: #cdcdcd;
          border-radius: 50%;
          font-size: 14rpx;
          padding: 3rpx;
          margin-top: -1rpx;
          color: #fff;
          margin-left: 4rpx;
          display: block;
          transform: rotate(180deg);
        }
      }
      .image-box {
        width: 80%;
        background: #fff;
        border-radius: 10rpx;
        overflow: hidden;
        position: relative;
        image {
          width: 100%;
          display: block;
        }
        .title {
          position: absolute;
          background: #00000085;
          bottom: 0;
          width: 100%;
          height: 26rpx;
          overflow: hidden;
          text-align: center;
          line-height: 26rpx;
          text-overflow: ellipsis;
          font-size: 18rpx;
          color: #fff;
          font-weight: 300;
        }
      }
      .price {
        font-size: 22rpx;
        line-height: 24rpx;
        margin-top: 10rpx;
        font-weight: 300;
        color: #ff0777;
      }
    }
  }
  .left-all {
    margin-right: 15rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    image {
      width: 70%;
    }
    .selected {
      font-weight: 700;
      font-size: 26rpx;
    }
  }
}
</style>
